package com.itheima.demo1.Test1;

public class GoodsTest {
    public static void main(String[] args) {
        //1.创建一个数组
        com.itheima.demo1.Goods[] arr = new com.itheima.demo1.Goods[3];

        //2.创建商品对象
        com.itheima.demo1.Goods g1 = new com.itheima.demo1.Goods("001","华为P40",5999.0,100);
        com.itheima.demo1.Goods g2 = new com.itheima.demo1.Goods("002","保温杯",227.0,50);
        com.itheima.demo1.Goods g3 = new com.itheima.demo1.Goods("003","枸杞",12.7, 70);

        //
        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;

        //4.遍历
        for (int i = 0; i < arr.length; i++) {
            com.itheima.demo1.Goods goods = arr[i];
            System.out.println(goods.getId() + "," + goods.getName()
                    + "," + goods.getPrice() + "," + goods.getCount());
        }
    }
}
